package com.edu.whty.dao;

import com.edu.whty.entity.base.JobMonitor;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * TODO
 *
 * @author luyao
 * @explain
 * @date 2021/5/28
 */
public interface JobMonitorDao {

    @Select("select * from t_job_monitor where job_id=#{jobId}")
    JobMonitor selectJobMonitor(@Param("jobId")String jobId);

    @Update("update t_job_monitor set status=#{status} , user_amount=#{userAmount}, syn_count=#{synCount},user_ids=#{userIds},syn_time=#{synTime} where job_id=#{jobId} ")
    int  updateJobMonitor(JobMonitor jobMonitor);

    @Insert("insert into t_job_monitor (job_id, status, user_amount, syn_count, user_ids,syn_time) values(#{jobId},#{status},#{userAmount},#{synCount},#{userIds},#{synTime} )")
    int addJobMonitor(JobMonitor jobMonitor);


    @Select("select * from t_job_monitor_jxzs where user_ids=#{userIds}")
    JobMonitor selectJxzsJobMonitor(@Param("userIds")String userIds);

    @Update("update t_job_monitor_jxzs set status=#{status} , user_amount=#{userAmount}, syn_count=#{synCount},user_ids=#{userIds},syn_time=#{synTime} where job_id=#{jobId} ")
    int  updateJxzsJobMonitor(JobMonitor jobMonitor);

    @Insert("insert into t_job_monitor_jxzs (job_id, status, user_amount, syn_count, user_ids,syn_time,platform_code) values(#{jobId},#{status},#{userAmount},#{synCount},#{userIds},#{synTime},#{platformCode} )")
    int addJxzsJobMonitor(JobMonitor jobMonitor);

    @Select("select * from t_job_monitor_jxzs where status=#{status} order by syn_time asc")
    List<JobMonitor> selectJxzsJobMonitorList(JobMonitor jobMonitor);
}
